<script>
	import store from './store'
	import socket from './net/socket'
	export default {
		onLaunch: function() {
			// console.warn('当前组件仅支持 uni_modules 目录结构 ，请升级 HBuilderX 到 3.1.0 版本以上！')
			// console.log('App Launch')
			store.token = uni.getStorageSync('token') || ''
			globalThis && (globalThis.store = store)

			// #ifdef APP-PLUS
			plus.screen.lockOrientation("portrait-primary")
			// #endif
		},
		onShow: function() {
			console.log('App Show')

			if (store.token) {
				socket.connect(store.token)
				uni.$on('message', this.getMessage)
			}
		},
		onHide: function() {
			console.log('App Hide')
		},
		methods: {
			getMessage(msg) {
				uni.showTabBarRedDot({ index: 0 })
			}
		}
	}
</script>

<style lang="scss">
	@import url("/static/font/iconfont.css");
	/*每个页面公共css */
	@import '@/uni_modules/uni-scss/index.scss';
	/* #ifndef APP-NVUE */
	@import '@/static/customicons.css';

	@import '@/static/common.scss';
	// 设置整个项目的背景色
	page {
		background-color: #f5f5f5;

	}

	/* #endif */
	.example-info {
		font-size: 14px;
		color: #333;
		padding: 10px;
	}
</style>
